package com.dz.lm.service.usermessage;

import com.dz.lm.common.dto.PageDto;
import com.dz.lm.common.exception.ServiceException;
import com.dz.lm.domain.usermessage.UserMessage;
import com.github.pagehelper.Page;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @version 1.8;
 * @author: LDY;
 * @Description;
 * @Date: Created in 2020/6/29 10:38;
 */
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

public interface UserMessageService {
    int add(UserMessage userMessage) throws ServiceException;

    /**
     * 按人删除私信
     * @param recordId 通讯录主键
     * @return
     * @throws ServiceException
     */
    int deleteByUser(int recordId) throws ServiceException;

    /**
     * 查看登录人消息列表
     * @param pageNum
     * @param rows
     * @param uid 登录人
     * @return
     * @throws ServiceException
     */
    PageDto query(int pageNum , int rows , int uid) throws ServiceException;

    /**
     * 查看消息详情
     * @param pageNum
     * @param rows
     * @param uid 登录人
     * @param sendUid 联系人
     * @return
     * @throws ServiceException
     */
    PageDto getDetail ( int pageNum, int rows ,int uid ,int sendUid) throws ServiceException;

    /**
     * 设置已读
     * @param uid
     * @param sendUid
     * @return
     * @throws ServiceException
     */
    int updateStatus(int uid, int sendUid) throws ServiceException;

    int getCount(int uid) throws ServiceException;

}
